const months = []

for (let i = 1; i <= 12; i++) {
	months.push({
		label: String(i),
		value: String(i)
	});
}

const hours = []

for (let i = 0; i <= 23; i++) {
	hours.push({
		label: String(i),
		value: String(i)
	});
}

const now = new Date();
// 获取年份
const _year = now.getFullYear();
// 获取月份，注意要补零
let _month = now.getMonth() + 1; // 月份是从0开始计数的，所以要加1
let month_formatted = _month < 10 ? `0${_month}` : _month;

// 获取日期，注意要补零
let _date = now.getDate();
let date_formatted = _date < 10 ? `0${_date}` : _date;

// 拼接成'YYYY-MM-DD'格式
const _day = `${_year}-${_month}-${_date}`;

// 获取小时
let _hour = now.getHours();



const chartOptions = [{
		label: "折线图",
		value: "line",
	},
	{
		label: "柱状图",
		value: "bar",
	},
];
const cycle = {
	value: "year",
	options: [{
			label: "年",
			value: "year",
		},
		{
			label: "月",
			value: "month",
		},
		{
			label: "日",
			value: "day",
		},
		{
			label: "小时",
			value: "hour",
		}
	],
};
const year = {
	start: {
		min: 2010,
		max: _year,
		value: _year,
	},
	end: {
		min: 2010,
		max: _year,
		value: _year,
	},
};
const month = {
	year: {
		min: 2010,
		max: _year,
		value: _year,
	},
	options: months,
	start: months[_month - 1].value,
	end: months[_month - 1].value,
};
const day = {
	start: _day,
	end: _day,
};
const hour = {
	date: _day,
	options: hours,
	start: hours[_hour].value,
	end: hours[_hour].value,
};
const lineChartData = {
	xAxisName: "历史充电量",
	xAxisData: ['2024-05-01', '2024-05-02', '2024-05-03', '2024-05-04', '2024-05-05', '2024-05-06', '2024-05-07'],
	yAxisName: "kWh",
	legendName: "充电量",
	seriesData: [100, 180, 10, 200, 120, 80, 30],
};
const barChartData = {
	xAxisName: "历史充电量",
	xAxisData: ['2024-05-01', '2024-05-02', '2024-05-03', '2024-05-04', '2024-05-05', '2024-05-06', '2024-05-07'],
	yAxisName: "kWh",
	legendName: "充电量",
	seriesData: [100, 180, 10, 200, 120, 80, 30],
};

export {
	chartOptions,
	cycle,
	year,
	month,
	day,
	hour,
	lineChartData,
	barChartData
};